{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7afe5fbe",
   "metadata": {},
   "source": [
    "## 上周回顾\n",
    "> * 1.list的一般方法/函数的使用及案例\n",
    ">> 1. append()增加，增加list元素到list末尾，常用于新建列表\n",
    ">> 2. pop(index)/remove(values)对比两者优势\n",
    ">> 3. count()查看某个元素出现的次数\n",
    ">> 4. index()查看某个元素第一次出现的位置\n",
    ">> 5. entend()两个list合并在一起，也可用[]+[]来实现\n",
    ">> 6. sort()list元素的排列\n",
    "> * 2.\n",
    ">> 1. copy()list(可变的数据类型)复制不等价于赋值，可用[:]来实现\n",
    ">> 2. enumerate()枚举，可同时遍历"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "dc2b195a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u']\n",
    "word = \"Milliways\"\n",
    "# 检查word中出现的元音，并打印怎么做？\n",
    "# for letter in word:# 第一个元素letter请不要和已有变量重名\n",
    "                     # 第二个元素一般不定义名字，常用item（元素）命名\n",
    "                     #                            简明i来命名\n",
    "                     # 第二个元素word(重要)，意味着遍历的内容\n",
    "                     # 遍历的内容一般是序列数据str list\n",
    "for letter in word:\n",
    "# print(word)\n",
    "    if letter in vowels:\n",
    "        print(letter)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c33b4cc4",
   "metadata": {},
   "source": [
    "### vowels2.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "672991a7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 使用append()新建列表\n",
    "found = []\n",
    "for letter in word:\n",
    "    # print(letter)\n",
    "    if letter in vowels: # letter 在元音字母表中\n",
    "        if letter not in found:# letter 不在found表中\n",
    "            found.append(letter)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5f67dc0a",
   "metadata": {},
   "source": [
    "## 购物车程序项目：\n",
    "要求：\n",
    "1.运行程序之后，让用户输入支付宝余额，然后打印我们的商品列表给用户。\n",
    "2.让用户输入商品编号进行商品的购买。\n",
    "3.用户选择商品后，检查用户的余额是否够，若够则直接扣款，不够则体系用户。\n",
    "4.用户可以随时退出购买，退出时打印用户已购买的商品和支付宝余额。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
